/*
 * Description: process preload entrance
 */
#ifndef PROCESS_PRELOAD_ENTRANCE_H
#define PROCESS_PRELOAD_ENTRANCE_H
#include <memory>
#include <string>
#include <unordered_map>
#include "constant/process_preload_constants.h"
#include "performance/perf_constants.h"
#include "preloader/base/process_preloader.h"
#include "preloader/ms_office_preloader.h"
#include "performance/model/perf_info.h"
#include "singleton.h"

namespace PERF {

class ProcessPreloadEntrance {
public:
    ProcessPreloadEntrance();
    std::shared_ptr<ProcessPreloader> GetPreloader(PreloadApp app);
    PreloadApp GetAppEnumByPname(const std::string &pname);
    void DoPreload(const std::string &pname);
    void DoAwaken(std::shared_ptr<PerfInfo> perfInfo);
    void Resume(const std::string &pname);

private:
    std::unordered_map<std::string, PreloadApp> pnameToApp{};
    std::unordered_map<PreloadApp, std::shared_ptr<ProcessPreloader>> appToPreloader{};
};
#define PROCESS_PRELOAD_ENTRANCE SingletonNew<PERF::ProcessPreloadEntrance>::GetInstance()
}  // namespace PERF
#endif
